#define _CRT_SECURE_NO_WARNINGS 1

#include "RBTree.h"
#include <iostream>
#include <set>
using namespace std;
using namespace kia;

struct GetKey
{
	template<class T>
	T operator()(const T& x)
	{
		return x;
	}
};

struct s1
{
	int _a;
	int _b;
};

int main()
{
	//RBTree<int> t1;
	/*t1.Insert(1);
	t1.Insert(2);
	t1.Insert(3);
	t1.Insert(4);*/
	/*t1.Insert(1);
	t1.Insert(3);
	t1.Insert(2);
	t1.Insert(4);
	t1.Insert(5);*/
	/*t1.Insert(4);
	t1.Insert(2);
	t1.Insert(3);*/
	/*t1.Insert(3);
	t1.Insert(2);
	t1.Insert(4);
	t1.Insert(5);*/
	/*cout << t1.RightMost() << endl;
	t1.Insert(1);
	t1.Insert(5);
	t1.Insert(6);
	cout << t1.LeftMost()->_data<<endl;
	cout << t1.RightMost()->_data<<endl;
	cout << t1.LeftMost()<< endl;
	cout << t1.RightMost()<<endl;
	cout << t1.Find(1) << endl;
	cout << t1.Find(7) << endl;*/
	/*for (int i = 0; i < 1000; ++i)
	{
		t1.Insert(i);
	}*/
	/*t1.Insert(4);
	t1.Insert(2);
	t1.Insert(6);
	t1.Insert(1);
	t1.Insert(3);
	t1.Insert(5);
	t1.Insert(15);
	t1.Insert(7);
	t1.Insert(16);
	t1.Insert(14);
	t1.Insert(11);*/
	/*cout << t1.Insert(1) << endl;
	cout<<t1.Insert(1)<<endl;*/
	//cout << t1.IsValidRBTree() << endl;
	RBTree<int,const int,GetKey> t1;
	t1.Insert(1);
	t1.Insert(2);
	t1.Insert(3);
	t1.Insert(4);
	t1.Insert(5);
	t1.Insert(6);
	t1.Insert(9);
	auto it = t1.Begin();
	while (it != t1.End())
	{
		cout << *it << endl;
		++it;
	}
	/*auto it = t1.End();
	while (it != t1.Begin())
	{
		--it;
		cout << *it << endl;
	}*/
	return 0;
}